#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include<cstdlib>
using namespace std;

class Solution {
public:
    bool isPalindrome(string s) {
        string news = this->Process(s);
        return this->isLoopStr(news);
    }

    // 预处理，删除非数字/字母字符
    string Process(const string& s){
        string news = "";
        for(auto ch:s){
            if((ch>='0' && ch<='9') || (ch>='a' && ch<='z')){
                news +=  ch;
            } else if(ch>='A' && ch<='Z'){
                news += ch-'A'+'a';
            }
        }
        return news;
    }

    // 判断是否是回文串
    bool isLoopStr(const string& s){
        int lp = 0, rp = s.size()-1;
        while (lp <= rp){
            if(s[lp] != s[rp]){
                return false;
            } else {
                lp++;
                rp--;
            }
        }
        return true;
    }
};

int main()
{
    Solution solu = Solution();
    cout<<solu.isPalindrome("A man, a plan, a canal: Panama")<<endl;
    return 0;
}